import numpy as np
import matplotlib.pyplot as plt
from sklearn.neural_network import MLPClassifier
from sklearn.metrics import precision_score,recall_score,f1_score,accuracy_score
x=np.loadtxt('jacketdata.txt',delimiter=',')
y=np.loadtxt('jacketlabels.txt',delimiter=',')

miu=np.mean(x)
sigma=np.std(x)
x=(x-miu)/sigma

np.random.seed(666)
a=np.random.permutation(len(x))
x=x[a]
y=y[a]
num=int(0.7*len(x))
train_x,test_x=np.split(x,[num,])
train_y,test_y=np.split(y,[num,])

model=MLPClassifier()
model.fit(train_x,train_y)

train_h=model.predict(train_x)
test_h=model.predict(test_x)

print(accuracy_score(train_y,train_h))
print(precision_score(test_y,test_h,average='micro'))
print(recall_score(test_y,test_h,average='micro'))
print(f1_score(test_y,test_h,average='micro'))